Ext.define('wmf.controller.resource.resource', {
    extend: 'Ext.app.Controller',
    stores: ['resource.tree',
             "resource.resource"
            ],
    models: [],
    views: ['resource.main', 
            'resource.tree',
            'resource.grid'
            ],
    refs: [{
        ref: 'resourceTree',
        selector: 'resourceTree'
    },{
    	ref: 'resourceGrid',
    	selector: 'resourceGrid'
    }],
    
    init: function () {
        this.control({
			'resourceTree' : {
				itemclick: this.menuClick
			}
        });
        wmf.resource = {};
        wmf.resource.params = {};
    },

    menuClick: function(tree, node, item, index, e, eOpts){
    	var me = this;
    	var grid = me.getResourceGrid();
    	wmf.resource.params.clickResourceId = node.data.resourceId;
		grid.getStore().reload();
    }
});
